package com.ysd.servlet.admin;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;
import com.ysd.dao.impl.UserDaoImpl;
import com.ysd.entity.User;
import com.ysd.util.BaseServlet;

public class AdminUserServlet extends BaseServlet {
	
	public void getLYB(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		UserDaoImpl uDao = new UserDaoImpl();//创建实现类对象
		List<User>  uList =uDao.getLYBList();//查到的所有留言
		//发送的Ajax 请求  服务器基本都会返回json格式字符串
		
		response.setCharacterEncoding("UTF-8");
		PrintWriter out = response.getWriter();
		Gson gson = new Gson();
		String res = gson.toJson(uList);
		
		out.print(res);
		
		out.flush();
		out.close();
	}

}
